<template>
    <div class="content">
        <!--返回头部
        <yd-backtop></yd-backtop>
        &lt;!&ndash;证件类型菜单&ndash;&gt;
        <yd-actionsheet :items="cardnoList" v-model="cardnoSheet"></yd-actionsheet>
        <yd-cell-group title="人员基本信息">
            <yd-cell-item>
                <span slot="left">姓名：</span>
                <yd-input slot="right" required v-model="formItem.name" max="20" :show-required-icon="false" placeholder="  一经提交无法修改"></yd-input>
            </yd-cell-item>
            <yd-cell-item>
                <span slot="left">性别：</span>
                <yd-radio-group slot="right" v-model="formItem.sex">
                    <yd-radio val="0">男</yd-radio>
                    <yd-radio val="1">女</yd-radio>
                </yd-radio-group>
            </yd-cell-item>
            <yd-cell-item arrow>
                <span slot="left">证件类型：</span>
                <input slot="right" type="text" @click.stop="cardnoSheet = true" v-model="formItem.card_name" readonly placeholder="请选择证件类型">
            </yd-cell-item>
            <yd-cell-item>
                <span slot="left">证件号码：</span>
                <yd-input slot="right" required v-model="formItem.card_no" @blur.native.capture="identityCodeValid(formItem.card_no)" :show-required-icon="false"></yd-input>
            </yd-cell-item>
            <yd-cell-item>
                <span slot="left">联系电话：</span>
                <yd-input slot="right" required regex="mobile" v-model="formItem.tel" :show-required-icon="false"></yd-input>
            </yd-cell-item>
            <yd-cell-item>
                <span slot="left">常住居民：</span>
                <yd-radio-group slot="right" v-model="formItem.is_permanent">
                    <yd-radio val="0">否</yd-radio>
                    <yd-radio val="1">是</yd-radio>
                </yd-radio-group>
            </yd-cell-item>
            <epidemic-other-handle></epidemic-other-handle>
        </yd-cell-group>
        <yd-cell-group title="来（返）沈情况">
        </yd-cell-group>
        <yd-cell-group title="其它信息">
        </yd-cell-group>-->
        <!--            *******-->
        <!--            *******-->
        <!--            *******-->
        <!--            人员基本信息-->
        <!--            *******-->
        <!--            *******-->
        <!--            *******-->
        <div>
            <div class="title">人员基本信息111</div>
            <van-field
                    v-model="nick_name"
                    label="姓名："
                    type="text"
                    placeholder="一经提交无法修改"
                    class="suggest"
            />
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label">
                    <span>性别：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="sex_radio">
                            <van-radio name="男" value="男" icon-size="18px">男</van-radio>
                            <van-radio name="女" value="女" icon-size="18px">女</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field">
                <span>证件类型：</span>
                <van-dropdown-menu>
                    <van-dropdown-item v-model="value4" :options="option4"/>
                </van-dropdown-menu>
            </div>
            <van-field
                    v-if="value4 !== 5"
                    v-model="card_no"
                    label="证件号码："
                    type="text"
                    placeholder="请输入证件号码"
            />
            <van-field
                    v-if="value4 === 5"
                    v-model="card_no"
                    label="证件号码："
                    type="text"
                    placeholder="无身份证填写父母身份证号"
            />
            <van-field
                    v-model="tel"
                    type="number"
                    label="联系电话："
                    placeholder="请输入联系电话"
            />
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label radio-item">
                    <span>是否常住居民：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="is_permanent">
                            <van-radio name="1" value="1" icon-size="18px">是</van-radio>
                            <van-radio name="0" value="0" icon-size="18px">否</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field">
                <span>区域类型：</span>
                <van-dropdown-menu>
                    <van-dropdown-item v-model="area_type" :options="area_type_option"/>
                </van-dropdown-menu>
            </div>
            <!--            <div class="suggest van-cell van-field">-->
            <!--                <div class="van-cell__title van-field__label radio-item">-->
            <!--                    <span>区域类型：</span>-->
            <!--                </div>-->
            <!--                <div class="van-cell__value">-->
            <!--                    <div class="van-field__body">-->
            <!--                        <van-radio-group v-model="area_type">-->
            <!--                            <van-radio name="1" value="1" icon-size="18px">城镇</van-radio>-->
            <!--                            <van-radio name="0" value="0" icon-size="18px">乡村</van-radio>-->
            <!--                        </van-radio-group>-->
            <!--                    </div>-->
            <!--                </div>-->
            <!--            </div>-->
            <div class="suggest van-cell van-field">
                <span>现居区域：</span>
                <van-dropdown-menu>
                    <van-dropdown-item v-model="idqu" :options="xinlistqu" @change="quyu"/>
                </van-dropdown-menu>
            </div>
            <div class="suggest van-cell van-field">
                <span>现居街道：</span>
                <van-dropdown-menu>
                    <van-dropdown-item v-model="idjie" :options="xinlistjie" @change="jiedao"/>
                </van-dropdown-menu>
            </div>
            <div class="suggest van-cell van-field" v-if="area_type === 1">
                <span>现居社区：</span>
                <van-dropdown-menu>
                    <van-dropdown-item v-model="idshe" :options="xinlistshe"/>
                </van-dropdown-menu>
            </div>
            <van-field
                    v-if="area_type === 2"
                    v-model="xiangcun"
                    type="text"
                    label="现居社区："
                    placeholder="请输入现居社区"
            />
            <div class="value-item">
                <van-field
                        v-model="dizhi"
                        type="text"
                        label="具体地址："
                        class="suggest"
                        placeholder="小区名,楼号,单元号,门牌号"
                />
            </div>
        </div>
        <!--            *******-->
        <!--            *******-->
        <!--            *******-->
        <!--            来(返)沈情况-->
        <!--            *******-->
        <!--            *******-->
        <!--            *******-->
        <div class="tou">
            <div class="title">来(返)沈情况</div>
            <div class="div1">
                <div class="van-cell van-field">
                    <div class="van-cell__title van-field__label">
                        <span>出发地：</span>
                    </div>
                    <div class="van-cell__value" @click="chufa">
                        <div class="van-field__body">
                            {{chufadi}}
                        </div>
                    </div>
                </div>
            </div>
            <van-field
                    v-if="is_permanent == 0"
                    v-model="arrive_time"
                    label="来(返)沈时间："
                    type="text"
                    placeholder="如是常住居民，此项不填"
                    class="suggest"
                    @click="shijian"/>
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label radio-item">
                    <span>是否途经武汉市：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="wuhan_radio">
                            <van-radio name="1" value="1" icon-size="18px">是</van-radio>
                            <van-radio name="0" value="0" icon-size="18px">否</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label radio-item">
                    <span>是否途经温州市：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="wenzhou_radio">
                            <van-radio name="1" value="1" icon-size="18px">是</van-radio>
                            <van-radio name="0" value="0" icon-size="18px">否</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label radio-item">
                    <span>是否途经湖北其它城市：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="hubei_radio">
                            <van-radio name="1" value="1" icon-size="18px">是</van-radio>
                            <van-radio name="0" value="0" icon-size="18px">否</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <!--            <div class="suggest van-cell van-field">-->
            <!--                <span>来沈交通方式：</span>-->
            <!--                <van-dropdown-menu>-->
            <!--                    <van-dropdown-item v-model="value1" :options="option1" />-->
            <!--                </van-dropdown-menu>-->
            <!--            </div>-->
            <!--            ****************飞机***************-->
            <!--            <div v-if="value1 == 3">-->
            <!--                <van-field-->
            <!--                        v-model=""-->
            <!--                        label="航班号："-->
            <!--                        type="text"-->
            <!--                        placeholder="请输入航班号"-->
            <!--                        class="suggest"-->
            <!--                />-->
            <!--                <van-field-->
            <!--                        v-model=""-->
            <!--                        label="经停地："-->
            <!--                        type="text"-->
            <!--                        placeholder="请输入经停地"-->
            <!--                        class="suggest"-->
            <!--                />-->
            <!--                <div class="suggest van-cell van-field">-->
            <!--                    <div class="van-cell__title van-field__label radio-item">-->
            <!--                        <span>是否下机：</span>-->
            <!--                    </div>-->
            <!--                    <div class="van-cell__value">-->
            <!--                        <div class="van-field__body">-->
            <!--                            <van-radio-group v-model="wugong_radio">-->
            <!--                                <van-radio name="1" value="1" icon-size="18px">是</van-radio>-->
            <!--                                <van-radio name="0" value="0" icon-size="18px">否</van-radio>-->
            <!--                            </van-radio-group>-->
            <!--                        </div>-->
            <!--                    </div>-->
            <!--                </div>-->
            <!--            </div>-->
        </div>
        <!--            *******-->
        <!--            *******-->
        <!--            *******-->
        <!--            其它信息-->
        <!--            *******-->
        <!--            *******-->
        <!--            *******-->
        <div class="other-info">
            <div class="title">其它信息</div>
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label radio-item">
                    <span>是否集中住宿务工人员：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="wugong_radio">
                            <van-radio name="1" value="1" icon-size="18px">是</van-radio>
                            <van-radio name="0" value="0" icon-size="18px">否</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field" v-if="wugong_radio == 1">
                <div class="van-cell__title van-field__label">
                    <span>企业名称：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <input v-model="wugong_name" type="text" placeholder="请输入企业名称" class="van-field__control">
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label radio-item">
                    <span>是否集中住宿在校学生：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="zaixiao_radio">
                            <van-radio name="1" value="1" icon-size="18px">是</van-radio>
                            <van-radio name="0" value="0" icon-size="18px">否</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field" v-if="zaixiao_radio == 1">
                <div class="van-cell__title van-field__label">
                    <span>学校名称：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <input v-model="zaixiao_name" type="text" placeholder="请输入学校名称" class="van-field__control">
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field">
                <div class="van-cell__title van-field__label radio-item">
                    <span>是否宾馆酒店住宿客人：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <van-radio-group v-model="jiudian_radio">
                            <van-radio name="1" value="1" icon-size="18px">是</van-radio>
                            <van-radio name="0" value="0" icon-size="18px">否</van-radio>
                        </van-radio-group>
                    </div>
                </div>
            </div>
            <div class="suggest van-cell van-field" v-if="jiudian_radio == 1">
                <div class="van-cell__title van-field__label">
                    <span>宾馆酒店名称：</span>
                </div>
                <div class="van-cell__value">
                    <div class="van-field__body">
                        <input v-model="jiudian_name" type="text" placeholder="请输入宾馆酒店名称" class="van-field__control">
                    </div>
                </div>
            </div>
        </div>
        <div class="div-bot">
            <div class="city-card-common-btn" @click="submit">提交</div>
            <div class="city-card-common-btn" @click="handleOther">办理其它社区（村）通行证</div>
        </div>
        <van-dialog
                use-slot
                title=""
                v-model="show"
                show-confirm-button
                @confirm="success"
                confirm-button-open-type="getUserInfo"
        >
            <div>
                <span>
                    您的电子通行证已生成!
                </span>
            </div>
        </van-dialog>
        <van-popup v-model="areaItem" position="bottom" :style="{ height: '40%' }">
            <van-area :area-list="AreaList"
                      value="210100"
                      @confirm="yes"
                      @cancel="close"
            />
        </van-popup>
        <van-popup v-model="show1" position="bottom">
            <van-datetime-picker
                    v-model="currentDate"
                    type="date"
                    @confirm="ok"
                    @cancel="quxiao"
            />
        </van-popup>
    </div>
</template>

<script>
// 业务接口
import { insertPermit, getUserPermitByOpenId } from '@/api/yi-qing-fang-kong.js'
// 获取用户信息
import { getUserLoginInfo } from '@/api/wx-api'
import { Dialog } from 'vant'
// import areaData from './data/areaData.js'
import mockData from './data/mockData'
// import District from 'ydui-district/dist/jd_province_city_area_id'
import { identityCodeValid } from '@/libs/tools'
// import EpidemicOtherHandle from '../epidemic-other-handle/new'

export default {
  // components: { EpidemicOtherHandle },
  data () {
    return {
      formItem: {},
      cardnoSheet: false,
      cardnoList: [
        {
          label: '请选择证件类型',
          value: 0,
          stay: true, /* 不关闭 */
          callback: (e) => {
            this.formItem.card_name = e.label
            this.formItem.card_type = e.value
          }
        },
        {
          label: '身份证',
          value: 1,
          callback: (e) => {
            this.formItem.card_name = e.label
            this.formItem.card_type = e.value
          }
        },
        {
          label: '军官证',
          value: 2,
          callback: (e) => {
            this.formItem.card_name = e.label
            this.formItem.card_type = e.value
          }
        },
        {
          label: '护照',
          value: 3,
          callback: (e) => {
            this.formItem.card_name = e.label
            this.formItem.card_type = e.value
          }
        },
        {
          label: '港澳通行证',
          value: 4,
          callback: (e) => {
            this.formItem.card_name = e.label
            this.formItem.card_type = e.value
          }
        },
        {
          label: '儿童',
          value: 5,
          callback: (e) => {
            this.formItem.card_name = e.label
            this.formItem.card_type = e.value
          }
        }
      ],
      areaList: mockData.areaList,
      streetList: mockData.streetList,
      communityList: mockData.communityList,
      xiangcun: '',
      area_type: 0,
      area_type_option: [
        { text: '社区', value: 1 },
        { text: '村', value: 2 }
      ],
      chufadi: '请选择出发地',
      AreaList: mockData,
      areaItem: false,
      is_permanent: '',
      card_no: '',
      sex_radio: '',
      hubei_radio: '',
      wenzhou_radio: '',
      wuhan_radio: '',
      changzhu_radio: '',
      jiudian_name: '',
      jiudian_radio: '',
      zaixiao_name: '',
      zaixiao_radio: '',
      wugong_name: '',
      wugong_radio: '',
      currentDate: new Date(),
      show1: false,
      idsheng: '',
      idcheng: '',
      dizhi: '',
      idqu: '',
      idjie: '',
      idshe: '',
      lianxi: '',
      pepole_content: '',
      huodong_content: '',
      juti_content: '',
      jiaotong_content: '',
      arrive_time: '',
      value1: 0,
      option1: [
        { text: '请选择交通方式', value: 0 },
        { text: '火车', value: 1 },
        { text: '飞机', value: 3 },
        { text: '大巴', value: 4 },
        { text: '自驾', value: 5 },
        { text: '综合交通', value: 6 }
      ],
      value2: 5,
      option2: [
        { text: '湖北武汉', value: 2 },
        { text: '湖北其它城市', value: 3 },
        { text: '浙江温州', value: 4 },
        { text: '其它省市', value: 5 }
      ],
      zhuangtai: '1',
      zhuangtailist: [
        { text: '入沈人员', value: '1' },
        { text: '离沈人员', value: '2' }
      ],
      value3: 0,
      option3: [
        { text: '正常', value: 0 },
        { text: '疑似病例', value: 2 },
        { text: '确诊病例', value: 3 },
        { text: '死亡', value: 4 },
        { text: '痊愈', value: 5 }
      ],
      radio: '1',
      lx_id_name: '',
      nick_name: '',
      idcard: '',
      tel: '',
      title: '',
      content: '',
      suggest: '',
      showPicker: false,
      show: false,
      return_back: '',
      value4: 0,
      listqu: [],
      listjie: [],
      listshe: [],
      listsheng: [],
      listcheng: [],
      xin: [],
      xinchengshi: [],
      xinlistjie: [],
      xinlistqu: [],
      xinlistshe: [],
      option4: [
        { text: '请选择证件类型', value: 0 },
        { text: '身份证', value: 1 },
        { text: '军官证', value: 2 },
        { text: '护照', value: 3 },
        { text: '港澳通行证', value: 4 },
        { text: '儿童', value: 5 }
      ],
      originate_province: '',
      originate_city: '',
      tip: '',
      id: ''
    }
  },
  methods: {
    biu () {
      console.log('点击')
    },
    handleOther () {
      this.$router.push({
        name: 'epidemic-other-handle',
        query: {}
      })
    },
    success () {
      this.$router.push({
        name: 'epidemic-submit-success',
        query: {
          'id': this.id
        }
      })
    },
    // 原即时对身份证姓名校验（废弃）
    changeCount () {
      if (this.card_no !== '' && this.card_no !== null && this.card_no !== undefined && this.nick_name !== '' && this.nick_name !== null && this.nick_name !== undefined) {
        // let type = this.identityCodeValid(this.card_no)
        let type = false
        if (this.value4 === 1 || this.value4 === 5) {
          // 身份证或儿童
          type = this.identityCodeValid(this.card_no)
        } else {
          type = true
        }
        if (type === false) {
          Dialog.alert({
            message: this.tip
          })
        } else {
          let data = { card_no: this.card_no }
          getUserInfoAppById(data).then(ret => {
            if (ret.data.data.ishave === 'true') {
              let data = JSON.parse(ret.data.data.userinfo)
              console.log(data)
              if (data.name === this.nick_name) {
                Dialog.alert({
                  message: '您的电子通行证已生成，请务必截图保存!'
                }).then(() => {
                  this.$router.push({
                    name: 'epidemic-submit-success',
                    query: {
                      'id': data.id
                    }
                  })
                })
              } else {
                Dialog.alert({
                  message: '姓名与证件号不符，请检查。'
                })
              }
            }
          })
        }
      }
    },
    isMobil (mobile) {
      let patrn = /(^0{0,1}1[3|4|5|6|7|8|9][0-9]{9}$)/
      if (!patrn.exec(mobile)) {
        return false
      }
      return true
    },
    identityCodeValid (code) {
      let rtn = identityCodeValid(code)
      console.log('原因', rtn.tip)
      console.log('状态', rtn.pass)
    },
    yes (data) {
      this.chufadi = data[0].name + data[1].name
      this.originate_province = data[0].name
      this.originate_city = data[1].name
      this.areaItem = false
    },
    close () {
      this.areaItem = false
    },
    chufa () {
      this.areaItem = true
    },
    quxiao () {
      this.show1 = false
    },
    ok () {
      this.arrive_time = this.currentDate.getFullYear() + '-' + (this.currentDate.getMonth() + 1) + '-' + this.currentDate.getDate()
      this.show1 = false
    },
    shijian () {
      this.show1 = true
    },
    quyu () {
      let newstreetList = []
      for (let i = 0; i < this.streetList.length; i++) {
        if (this.idqu === this.streetList[i].pid) {
          newstreetList.push(this.streetList[i])
        }
      }
      this.listjie = newstreetList
      this.xinlistjie = []
      this.xinlistshe = []
      for (let i = 0; i < this.listjie.length; i++) {
        this.xinlistjie.push(
          {
            text: this.listjie[i].name,
            company_code: this.listjie[i].company_code,
            value: this.listjie[i].id,
            id: this.listjie[i].id,
            level: this.listjie[i].level
          })
      }
    },
    jiedao () {
      let newcommunityList = []
      for (let i = 0; i < this.communityList.length; i++) {
        if (this.idjie === this.communityList[i].pid) {
          newcommunityList.push(this.communityList[i])
        }
      }
      this.listshe = newcommunityList
      this.xinlistshe = []
      for (let i = 0; i < this.listshe.length; i++) {
        this.xinlistshe.push({
          company_code: this.listshe[i].company_code,
          text: this.listshe[i].name,
          value: this.listshe[i].id,
          id: this.listshe[i].id,
          level: this.listshe[i].level
        })
      }
    },
    findlist () {
      this.xinlistqu = []
      this.xinlistshe = []
      for (let i = 0; i < this.areaList.length; i++) {
        this.xinlistqu.push({
          company_code: this.areaList[i].company_code,
          text: this.areaList[i].name,
          value: this.areaList[i].id,
          id: this.areaList[i].id,
          level: this.areaList[i].level
        })
      }
    },
    submit () {
      if (this.nick_name === '' || this.nick_name === undefined || this.nick_name === null) {
        Dialog.alert({
          message: '请输入姓名！'
        })
        return false
      }
      if (this.value4 === '' || this.value4 === undefined || this.value4 === null || this.value4 === 0) {
        Dialog.alert({
          message: '请选择身份证类型！'
        })
        return false
      }
      if (this.card_no === '' || this.card_no === undefined || this.card_no === null) {
        Dialog.alert({
          message: '请输入证件号码！'
        })
        return false
      } else {
        if (this.value4 === 1) {
          if (!this.identityCodeValid(this.card_no)) {
            Dialog.alert({
              message: this.tip
            })
            return false
          }
        }
      }

      if (!this.isMobil(this.tel)) {
        Dialog.alert({
          message: '输入正确手机号!'
        })
        return false
      }
      if (this.area_type === '' || this.area_type === undefined || this.area_type === null || this.area_type === 0) {
        Dialog.alert({
          message: '请选择区域类型！'
        })
        return false
      }
      let data = {
        name: this.nick_name,
        sex: this.sex_radio,
        card_type: this.value4,
        tel: this.tel,
        is_permanent: this.is_permanent,
        address: this.dizhi,
        arrive_time: this.arrive_time,
        originate_province: this.originate_province,
        originate_city: this.originate_city,
        user_type: this.area_type
      }
      if (this.is_permanent === 0) {
        data.arrive_time = this.arrive_time
      } else {
        data.arrive_time = '1000-01-01 00:00:00'
      }
      if (this.idqu === '' || this.idqu === null || this.idqu === undefined) {
        Dialog.alert({
          message: '请选择现居区域!'
        })
        return false
      }
      if (this.idjie === '' || this.idjie === null || this.idjie === undefined) {
        Dialog.alert({
          message: '请选择现居街道!'
        })
        return false
      }
      if (this.area_type === 1) {
        for (let i = 0; i < this.xinlistjie.length; i++) {
          if (this.idjie === this.xinlistjie[i].id) {
            // data.company_code = this.xinlistjie[i].company_code
            data.street = this.xinlistjie[i].text
          }
        }
        for (let i = 0; i < this.xinlistqu.length; i++) {
          if (this.idqu === this.xinlistqu[i].id) {
            data.area = this.xinlistqu[i].text
          }
        }
        for (let i = 0; i < this.xinlistshe.length; i++) {
          if (this.idshe === this.xinlistshe[i].id) {
            data.company_code = this.xinlistshe[i].company_code
            data.community = this.xinlistshe[i].text
          }
        }
        if (this.idshe === '' || this.idshe === null || this.idshe === undefined) {
          Dialog.alert({
            message: '请选择现居社区!'
          })
          return false
        }
      }
      if (this.area_type === 2) {
        for (let i = 0; i < this.xinlistjie.length; i++) {
          if (this.idjie === this.xinlistjie[i].id) {
            data.company_code = this.xinlistjie[i].company_code
            data.street = this.xinlistjie[i].text
          }
        }
        for (let i = 0; i < this.xinlistqu.length; i++) {
          if (this.idqu === this.xinlistqu[i].id) {
            data.area = this.xinlistqu[i].text
          }
        }
        data.community = this.xiangcun
        if (this.xiangcun === '' || this.xiangcun === null || this.xiangcun === undefined) {
          Dialog.alert({
            message: '请输入现居社区!'
          })
          return false
        }
      }
      if (this.wugong_radio === '1') {
        data.concentration_type = '1'
        data.concentration_type_remark = this.wugong_name
      }
      if (this.zaixiao_radio === '1') {
        data.concentration_type = '2'
        data.concentration_type_remark = this.zaixiao_name
      }
      if (this.jiudian_radio === '1') {
        data.concentration_type = '3'
        data.concentration_type_remark = this.jiudian_name
      }
      // 不知道儿童身份证号输入父母身份证号，后追加三位随机数
      if (this.value4 === 5) {
        let rand = ''
        for (let i = 0; i < 3; i++) {
          let r = Math.floor(Math.random() * 10)
          rand += r
        }
        console.log(rand)
        data.card_no = this.card_no + rand
      } else {
        data.card_no = this.card_no
      }
      /* // 是否途径武汉
                data.istjwh = this.wuhan_radio === '1' ? 0 : 1
                // 是否途径温州
                data.istjwz = this.wenzhou_radio === '1' ? 0 : 1
                // 是否途径湖北其它城市
                data.ishbqics = this.hubei_radio === '1' ? 0 : 1
                // 是否集中住宿务工人员
                data.isworker = this.wugong_radio === '1' ? 0 : 1
                // 企业名称
                data.enterprise_name = this.wugong_radio === '1' ? this.wugong_name : ''
                // 是否集中住宿在校学生
                data.isstudent = this.zaixiao_radio === '1' ? 0 : 1
                // 学校名称
                data.school_name = this.zaixiao_radio === '1' ? this.zaixiao_name : ''
                // 是否宾馆酒店住宿客人
                data.isguest = this.jiudian_radio === '1' ? 0 : 1
                // 酒店名称
                data.guest = this.jiudian_radio === '1' ? this.jiudian_name : '' */
      if (this.wuhan_radio === '1') {
        if (this.wenzhou_radio === '1') {
          if (this.hubei_radio === '1') {
            data.viaway = '武汉市,温州市,湖北其它城市'
          } else {
            data.viaway = '武汉市,温州市'
          }
        } else {
          if (this.hubei_radio === '1') {
            data.viaway = '武汉市,湖北其它城市'
          } else {
            data.viaway = '武汉市'
          }
        }
      } else {
        if (this.wenzhou_radio === '1') {
          if (this.hubei_radio === '1') {
            data.viaway = '温州市,湖北其它城市'
          } else {
            data.viaway = '温州市'
          }
        } else {
          if (this.hubei_radio === '1') {
            data.viaway = '湖北其它城市'
          } else {
            data.viaway = ''
          }
        }
      }
      console.log(data)
      this.insertPermit(data)
    },
    insertPermit (data) {
      insertPermit(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.show = true
          this.id = ret.data.data.id
        } else {
          Dialog.alert({
            message: ret.data.errmsg
          })
          return false
        }
      })
    },
    getUserPermitByOpenId () {
      getUserPermitByOpenId().then(ret => {
        if (ret.data.errcode === 0) {
          console.log('=提报页面获取个人信息判断=', ret.data)
          if (ret.data.data.result) {
            this.$router.push({
              name: 'epidemic-submit-success',
              query: {}
            })
          }
        } else {
          Dialog.alert({
            message: ret.data.errmsg
          })
          return false
        }
      })
    },
    getMyInfo () {
      getUserLoginInfo().then(ret => {
        console.log('提报页获取登录信息回调', ret.data)
        if (ret.data.errcode === 200) {
          // 判断是否提报
          // this.getUserPermitByOpenId()
        } else {
          Dialog.alert({
            message: '请登录'
          })
        }
      })
    }
  },
  mounted () {
    // 获取登录信息
    this.getMyInfo()
    this.findlist()
    // Dialog.alert({
    //   messageAlign: 'left',
    //   message: '       疫情防控期间，本人授权沈阳市人民政府合法了解、获取、核实本人的个人信息，但不得作为商业用途使用。 '
    // })
  }
}
</script>

<style scoped>
    /*最外层背景*/
    .content {
        width: 100%;
        background-color: #F5F5F5;
    }

    /*内层cell左右留白*/
    .content >>> .yd-cell {
        margin-left: 2%;
        width: 96%;
    }

    /*表单分割线*/
    /deep/ .yd-cell-item:not(:last-child):after {
        height: 0.1625rem;
    }

    /*sheet分割线*/
    /deep/ .yd-actionsheet-item:after {
        height: 0.1625rem;
    }

    /*.van-radio {
        float: left;
        margin-right: 10px;
    }

    .title {
        width: 100%;
        padding: 0.625rem 0.9375rem;
        font-size: 12px;
    }

    .action-item .van-cell__title {
        -webkit-box-flex: inherit;
        -webkit-flex: inherit;
        flex: inherit;
        width: 5.625rem;
    }

    .find {
        border-radius: 25px;
        background-color: #996666;
        color: white;
        margin-top: 15px;
        height: 33px;
        line-height: 1px;
        margin-left: 2%;
        width: 96%;
    }

    .content >>> .van-dialog__content {
        padding: 10px;
        text-align: center;
    }

    .van-field__control {
        font-size: 12px;
    }

    .content >>> .van-cell__value .van-field__body .van-field__control {
        font-size: 12px;
    }

    .city-card-common-btn:nth-of-type(1) {
        color: white;
        font-size: 12px;
        padding: 10px 0;
        width: 100%;
        border-radius: 5px;
        text-align: center;
        background-color: #7AB46D;
        margin-bottom: 5px;
    }

    .city-card-common-btn:nth-of-type(2) {
        color: white;
        font-size: 12px;
        padding: 10px 0;
        width: 100%;
        border-radius: 5px;
        text-align: center;
        background-color: #75ACDC;
    }

    .div-bot {
        padding: 8px;
    }

    .content >>> .van-cell__value {
        flex: inherit;
        font-size: 12px;
    }

    .content >>> .value-item .van-cell__value {
        width: 100%;
    }

    .van-action-sheet__cancel, .van-action-sheet__item {
        font-size: 12px;
    }

    .van-cell__value span {
        !*color: black;*!
    }

    .van-dropdown-menu {
        height: 25px;
    }

    .van-hairline--top-bottom::after {
        border-width: 0px 0px;
    }

    .chaochu >>> .van-cell__value {
        width: 100%;
    }

    .div1 >>> .van-cell__value {
        width: 100%;
    }

    .div2 >>> .van-cell__value {
        width: 100%;
    }

    .other-info .van-field__label.radio-item, .tou .van-field__label.radio-item {
        width: 8.625rem;
    }

    .suggest.van-cell.van-field span {
        width: 5rem;
    }*/
</style>
